#!/bin/bash

set +e

if [ -z "$1"  ]
then
  echo "请设置起始值！"
  exit 1;
fi
# Committing

token=$(lotus-miner auth create-token --perm admin)
method="SectorsListInStates"

# curl -X POST \
#   -H "Content-Type: application/json" \
#   -H "Authorization: Bearer $token" \
#   --data '{"jsonrpc":"2.0", "id":2, "method":"Filecoin.'"$method"'", "params":[]}' \
#   'http://127.0.0.1:2345/rpc/v0'

curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $token" \
    --data "{\"jsonrpc\":\"2.0\", \"id\":3, \"method\":\"Filecoin.$method\", \"params\": [[\"$1\"]]}" \
    'http://127.0.0.1:29735/rpc/v0'
    


# curl -X POST \
#     -H "Content-Type: application/json" \
#     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.uPtTHSCL7tLdh4PLqWtiToh7WXqk_etd3J2cJLnYwz4" \
#     --data "{\"jsonrpc\":\"2.0\", \"id\":3, \"method\":\"Filecoin.SectorsListInStates\", \"params\": [[\"PreCommitWait\"]]}" \
#     'http://127.0.0.1:2345/rpc/v0'
